<template>
	<view class='recommend'>
		<view class='title acea-row row-center-wrapper'>
			<text class='iconfont icon-zhuangshixian'></text>
			<text class='name'>
				<!-- 热门推荐 -->
				{{i18n.user_page.user_money.t12}}
			</text>
			<text class='iconfont icon-zhuangshixian lefticon'></text>
		</view>
		<view class='recommendList acea-row row-between-wrapper'>
			<view class='item r-bg' v-for="(item,index) in hostProduct" :key="index" hover-class='none' @tap="goDetail(item)">
				<view class='pictrue'>
					<image :src='item.good_header || defaultImg'></image>
					<span class="pictrue_log_big pictrue_log_class" v-if="item.activityH5 && item.activityH5.type === '1'">
						<!-- 秒杀 -->
						{{i18n.user_page.user_money.t13}}
					</span>
					<span class="pictrue_log_big pictrue_log_class" v-if="item.activityH5 && item.activityH5.type === '2'">
						<!-- 砍价 -->
						{{i18n.user_page.user_money.t14}}
					</span>
					<span class="pictrue_log_big pictrue_log_class" v-if="item.activityH5 && item.activityH5.type === '3'">
						<!-- 拼团 -->
						{{i18n.user_page.user_money.t15}}
					</span>
				</view>
				<view class='name line1'>{{item.good_name}}</view>
				<view class='money font-color'>$<text class='num'>{{item.good_price}}</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapGetters} from "vuex";
	import { goShopDetail } from '@/libs/order.js'
	export default {
	computed: mapGetters(['uid']),
		props: {
			hostProduct: {
				type: Array,
				default: function() {
					return [];
				}
			}
		},
		data() {
			return {
				defaultImg: require("@/static/img/default_img.png"),
			};
		},
		computed: {
			i18n() {
				return this.$t('index')
			}
		},
		onReady: function() {
			uni.setNavigationBarTitle({
				title: this.i18n.user_page.title
			});
		},
		methods: {
			goDetail(item){
				goShopDetail(item,this.uid).then(res=>{
					uni.navigateTo({
						url:`/pages/lottery/good_details/good_details?id=${item.id}`
					})
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.recommend {
		// background-color: #fff;
	}

	.recommend .title {
		height: 135rpx;
		font-size: 28rpx;
		color: #787878;
	}

	.recommend .title .name {
		margin: 0 28rpx;
	}

	.recommend .title .iconfont {
		font-size: 100rpx;
		color: #454545;
	}

	.recommend .title .iconfont.lefticon {
		transform: rotate(180deg);
	}

	.recommend .recommendList {
		padding: 0 30rpx;
		// width: 96%;
		// margin: 0 auto;
		/* #ifdef H5 */
		padding-bottom: 50rpx;
		/* #endif */
	}

	.recommend .recommendList .item {
		width: 335rpx;
		margin-bottom: 30rpx;
		border-radius: 6px;
		overflow: hidden;
	}

	.recommend .recommendList .item .pictrue {
		position: relative;
		width: 94%;
		margin: 5px auto;
		height: 335rpx;
	}

	.recommend .recommendList .item .pictrue image {
		width: 100%;
		height: 100%;
		border-radius: 6rpx;
	}

	.recommend .recommendList .item .name {
		width: 94%;
		font-size: 24rpx;
		color: #282828;
		margin: 20rpx auto 0;
	}

	.recommend .recommendList .item .money {
		width: 94%;
		font-size: 20rpx;
		// margin-top: 8rpx;
		margin: 8rpx auto;
	}

	.recommend .recommendList .item .money .num {
		font-size: 28rpx;
	}
	.r-bg{
		background-color: #fff;
	}
</style>
